//
//  LHHttpTool.m
//  OCSinaWeibo
//
//  Created by LiHong on 15/11/2.
//  Copyright © 2015年 LiHong. All rights reserved.
//

#import "LHHttpTool.h"
#import "AFNetworking.h"
@implementation LHHttpTool
+ (void)GET:(NSString *)url parameters:(id)params success:(void(^)(id))success failure:(void(^)(NSError *))failure{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    [manager GET:url parameters:params success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
        if (failure) {
            failure(error);
        }
    }];
}

+ (void)POST:(NSString *)url parameters:(id)params success:(void(^)(id))success failure:(void(^)(NSError *))failure{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    [manager POST:url parameters:params success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
        if (failure) {
            failure(error);
        }
    }];
    
    
}
@end
